#include <gtest/gtest.h>


// #include "../src/trophy.hpp"
#include "../src/player.hpp"
// #include "../src/datatable.hpp"
// #include "../src/dbmemory.hpp"

#include <nlohmann/json.hpp>
#include <fstream>

class TestPlayer : public ::testing::Test {
protected:
	void SetUp() override {
// 		jsonData.push_back({true, "{\"testMilitaryChallenge\":525,\"baselineMilitary\":515,\"bonuses\":[[41],[7],[5.054],[1.1275],[50],[10],[10],[100],[97]],\"orbProgress\":0,\"baselineResources\":[[2436949],[4014150],[1626667]],\"onhandResources\":[[38747],[560109]],\"ship1\":[[0],[0],[75],[0]],\"ship2\":[[32],[0],[80],[0]],\"ship3\":[[110],[0],[91],[112]],\"testShip1\":[[0],[0],[85],[0]],\"testShip2\":[[32],[0],[80],[0]],\"testShip3\":[[110],[0],[92],[112]],\"drones\":[[25],[25],[25],[25],[25]],\"fourthDrone\":\"Regen\",\"fifthDrone\":\"Leech\",\"testDrones\":[[25],[25],[25],[25],[25]],\"testFourthDrone\":\"Regen\",\"testFifthDrone\":\"Leech\"}"});
// 		jsonData.push_back({true, "{\"testMilitaryChallenge\":525,\"baselineMilitary\":515,\"yobana\":545,\"bonuses\":[[41],[7],[5.054],[1.1275],[50],[10],[10],[100],[97]],\"orbProgress\":0,\"baselineResources\":[[2436949],[4014150],[1626667]],\"onhandResources\":[[38747],[560109]],\"ship1\":[[0],[0],[75],[0]],\"ship2\":[[32],[0],[80],[0]],\"ship3\":[[110],[0],[91],[112]],\"testShip1\":[[0],[0],[85],[0]],\"testShip2\":[[32],[0],[80],[0]],\"testShip3\":[[110],[0],[92],[112]],\"drones\":[[25],[25],[25],[25],[25]],\"fourthDrone\":\"Regen\",\"fifthDrone\":\"Leech\",\"testDrones\":[[25],[25],[25],[25],[25]],\"testFourthDrone\":\"Regen\",\"testFifthDrone\":\"Leech\"}" });
// 		jsonData.push_back({false, "{\"testMilitaryChallenge\":525,\"yobana\":545,\"bonuses\":[[41],[7],[5.054],[1.1275],[50],[10],[10],[100],[97]],\"orbProgress\":0,\"baselineResources\":[[2436949],[4014150],[1626667]],\"onhandResources\":[[38747],[560109]],\"ship1\":[[0],[0],[75],[0]],\"ship2\":[[32],[0],[80],[0]],\"ship3\":[[110],[0],[91],[112]],\"testShip1\":[[0],[0],[85],[0]],\"testShip2\":[[32],[0],[80],[0]],\"testShip3\":[[110],[0],[92],[112]],\"drones\":[[25],[25],[25],[25],[25]],\"fourthDrone\":\"Regen\",\"fifthDrone\":\"Leech\",\"testDrones\":[[25],[25],[25],[25],[25]],\"testFourthDrone\":\"Regen\",\"testFifthDrone\":\"Leech\"}"});
// 		jsonData.push_back({false, "{\"testMilitaryChallenge\":525 \"baselineMilitary\":515,\"yobana\":545,\"bonuses\":[[41],[7],[5.054],[1.1275],[50],[10],[10],[100],[97]],\"orbProgress\":0,\"baselineResources\":[[2436949],[4014150],[1626667]],\"onhandResources\":[[38747],[560109]],\"ship1\":[[0],[0],[75],[0]],\"ship2\":[[32],[0],[80],[0]],\"ship3\":[[110],[0],[91],[112]],\"testShip1\":[[0],[0],[85],[0]],\"testShip2\":[[32],[0],[80],[0]],\"testShip3\":[[110],[0],[92],[112]],\"drones\":[[25],[25],[25],[25],[25]],\"fourthDrone\":\"Regen\",\"fifthDrone\":\"Leech\",\"testDrones\":[[25],[25],[25],[25],[25]],\"testFourthDrone\":\"Regen\",\"testFifthDrone\":\"Leech\"}"});
// 		jsonData.push_back({false, "{\"test\":5}\n"});
	}

	void TearDown() override {

	}

	std::vector<std::pair<bool, std::string>> jsonData;
};


TEST_F(TestPlayer, jsonCheck){
	//TODO
	for( auto i : jsonData ){
		auto json = ""_json;
		EXPECT_NO_THROW( json = i.second.c_str());
		ASSERT_EQ(i.first, Player::checkJSON(json));
	}
}
